package com.giggle.demo;

import com.alibaba.nacos.api.annotation.NacosProperties;
import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@NacosPropertySource(dataId = "giggle-demo.properties", groupId = "demo", autoRefreshed = true,properties = @NacosProperties(namespace = "7c22b50a-55f9-492c-81c3-e05199b9958b"))
@Slf4j
public class DemoApplication implements InitializingBean {

    @Value(value = "${nacos:error}")
    private String nacos;

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("属性注入后，输入{}",nacos);
    }
}
